package m202406.d05;

import java.util.Arrays;
import java.util.Scanner;

/**
 * @@author: 爱做梦的锤子
 * @date: 2024/6/5 19:59
 */
public class D15_01 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] split = scanner.nextLine().split(" ");
        int n = Integer.parseInt(split[0]);
        int target = Integer.parseInt(split[1]);
        int[] array = Arrays.stream(scanner.nextLine().split(" "))
                .mapToInt(Integer::parseInt)
                .toArray();
        if (n == 0) {
            System.out.println(0);
            return;
        }
        if (target == 0) {
            int sum = 0;
            for (int i = 1; i <= n; i++) {
                sum = sum + i;
            }
            System.out.println(sum);
            return;
        }
        int i = 0;
        int j = 0;
        int sum = 0;
        long rs = 0;
        while (true) {
            if (sum >= target) {
                rs = rs + n - j + 1;
                sum = sum - array[i];
                i++;
            } else {
                sum = sum + array[j];
                j++;
            }
            if (j >= n && sum < target) {
                break;
            }
        }
        System.out.println(rs);
    }
}
